package com.rgs.base.redis.service;

import java.util.function.Supplier;

/**
 * @author Ren Gaoshuai
 * @ClassName GlobalAtomService
 * @Description redis 自增服务
 * @create 2021-12-24 16:38
 **/
public interface GlobalAtomService {

    /**
     * 自增获取值
     * @param key       key键
     * @param delta     步长
     * @param def       默认值，Key中不存在则使用该默认值
     * @return
     */
    Long incrementLong(String key, long delta, long def);

    Long incrementLong(String key, long delta, Supplier<Long> supplier);

    Long incrementLong(String key, Supplier<Long> supplier);

    Long incrementLong(String key);
}
